<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <title>微观世界</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <!--[if IE]>
    <script src="<?php echo SCScabish::core('url')->root?>/public/js/html5.js"></script>
    <![endif]-->
    <link rel="stylesheet" href="<?php echo SCScabish::core('url')->root?>/public/style/style.css" type="text/css" media="screen" />
    <link rel="stylesheet" href="<?php echo SCScabish::core('url')->root?>/public/js/fancybox/jquery.fancybox.css" type="text/css" media="screen" />
    <link rel="stylesheet" href="<?php echo SCScabish::core('url')->root?>/public/js/dialog/skins/default.css" type="text/css" media="screen" />
    <script src="<?php echo SCScabish::core('url')->create('server/side')?>" type="text/javascript"></script>
    <script src="<?php echo SCScabish::core('url')->root?>/public/js/jquery.js" type="text/javascript"></script>
    <script src="<?php echo SCScabish::core('url')->root?>/public/js/fancybox/jquery.fancybox.js" type="text/javascript"></script>
    <script src="<?php echo SCScabish::core('url')->root?>/public/js/fancybox/jquery.mousewheel.js" type="text/javascript"></script>
    <script src="<?php echo SCScabish::core('url')->root?>/public/js/dialog/jquery.artdialog.min.js" type="text/javascript"></script>
    <script src="<?php echo SCScabish::core('url')->root?>/public/js/thing/view.js" type="text/javascript"></script>
</head>
<body>
	
	<?php require $this->view->load('header'); ?>
    
    <section id="SC_container" style="padding-top:50px;">
    	<section id="SC_left">
    		<div class="profile">
    			
    			<div style="height:180px;">
    				<img src="<?php echo $user_info->avatar_3?>" style="width:180px;max-width:180px;" />
    			</div>
    			
    			<p><?php echo $user_info->nickname?></p>
    			
    		</div>
    	</section>
    	<section id="SC_middle">
    		
    		
    		<div class="thing" data-thing-id="<?php echo $thing->thing_id?>" data-thing-type="<?php echo $thing->type?>">
    			<div class="timeline" style="visibility:hidden;">
    				<?php echo $thing->post_date?>
    			</div>
    			<div class="content">
					<?php echo nl2br($thing->text)?>
    			</div>
    			<?php if($thing->type == 'photo') { ?>
	    		<div class="photo">
    				<div class="medium">
	    				<img src="<?php echo SCScabish::core('url')->root?>/upload/<?php echo $thing->photos[0]->thumbs[400]['path']?>" />
	    				<span class="count"><?php echo count($thing->photos)?>p</span>
    				</div>
    				<ul class="thumbnail">
    					<?php foreach($thing->photos as $i=>$photo) { ?>
    					<li<?php if($i > 5){?> style="display:none;"<?php }?>>
    						<a class="fancybox" rel="group<?php echo $thing->thing_id?>" href="<?php echo SCScabish::core('url')->root?>/upload/<?php echo $photo->path?>" title="<?php echo $thing->text?>" onclick="return false;">
    							<img src="<?php echo SCScabish::core('url')->root?>/upload/<?php echo $photo->thumbs[80]['path']?>" />
    						</a>
    					</li>
    					<?php } ?>
    				</ul>
    			</div>
	    		<?php } elseif($thing->type == 'video') { ?>
	    		<div class="video">
    				<img src="<?php echo SCScabish::core('url')->root?>/upload/<?php echo $thing->video->preview_path?>" width="<?php echo $thing->video->preview_width?>" height="<?php echo $thing->video->preview_height?>" />
    				<div class="play" data-video-url="<?php echo $thing->video->url?>" 
    					data-video-width="<?php echo $thing->video->width?>" data-video-height="<?php echo $thing->video->height?>">
    				</div>
    			</div>
    			<div class="player" style="display:none;"></div>
	    		<?php } elseif($thing->type == 'music') {?>
	    		<div class="music">
    				<img src="<?php echo SCScabish::core('url')->root?>/upload/<?php echo $thing->music->preview_path?>" width="<?php echo $thing->music->preview_width?>" height="<?php echo $thing->music->preview_height?>" />
    				<div class="play" data-music-url="<?php echo $thing->music->url?>" 
    					data-music-width="<?php echo $thing->music->width?>" data-music-height="<?php echo $thing->music->height?>">
    				</div>
    			</div>
    			<div class="player" style="display:none;"></div>
	    		<?php } ?>
    			<div class="opt clear" style="position:relative;">
    				<span style="position:absolute;left:0;"><?php echo count($comments)?>个回应</span>
					<a class="edit" href="javascript:;" style="display:none;"></a>
    				<a class="delete" href="javascript:;" style="display:none;"></a>
    				<a class="mark" href="javascript:;"></a>
    				<a class="share" href="javascript:;"></a>
    			</div>
    			<div class="echoes">
    				<div>
    					<form id="reply_form">
							<textarea style="width:560px;height:20px;srcoll:none;overflow:hidden;" name="text"></textarea>
							<input type="hidden" name="thing_id" value="<?php echo $thing->thing_id?>" />
	    					<input type="button" value="回应" />
    					</form>
    				</div>
    				<ul class="comment" style="margin-top:10px;">
    					<?php foreach($comments as $v) { ?>
						<li data-comment-id="<?php echo $v->comment_id?>">
							<a href="/u/<?php echo $v->user_id?>">
								<img style="float:left;width:30px;" class="avatar" alt="" src="<?php echo $v->avatar?>">
							</a>
							<div style="float:left;margin-left:10px;">
								<span class="remove-comment"></span>
								<div class="content">
									<a class="bbl-name-card" href="/u/<?php echo $v->user_id?>" data-uid="<?php echo $v->user_id?>"><?php echo $v->nickname?></a>
									<?php echo $v->text?>
								</div>
								<div class="footer">
									<span class="timestamp" timestamp="<?php echo strtotime($v->post_date)?>" style="color:#ddd;text-shadow:none;font-size:12px;"><?php echo $v->post_date?></span>
									<a class="reply-echo" href="javascript:;" style="display:none;">回复</a>
								</div>
							</div>
							<div style="clear:both;"></div>
						</li>
						<?php } ?>
					</ul>
					<div class="page" id="comment_page"><?php echo SCPaging::create()?></div>
    			</div>
    		</div>
    		
    	</section>
    	<section id="SC_right">
    		
    	</section>
    	<div class="clear"></div>
    </section>
    
    <footer>
    
    </footer>
    <script type="text/javascript">
    $(function() {
    	SingleThing.init(<?php echo $thing->thing_id?>);
    	ThingComment.init({
    		'thing_id' : <?php echo $thing->thing_id?>,
    		'page_id' :  'comment_page',
    		'num_per_page' : 10,
        });
    	ReplyForm.init({
			'form_id' : 'reply_form',
			'thing_id' : <?php echo $thing->thing_id?>
        });
	});
    </script>
    
    <?php require $this->view->load('footer'); ?>
    
</body>
</html>   